package cloud.xlh.my_system;

import com.yomahub.tlog.core.enhance.bytes.AspectLogEnhance;
import io.micrometer.core.instrument.MeterRegistry;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.retry.annotation.EnableRetry;


@EnableRetry
@ComponentScan(value = "cloud.xlh.*")
@MapperScan(basePackages = "cloud.xlh.my_system.mapper")
@SpringBootApplication
public class MySystemApplication {
    static {
        AspectLogEnhance.enhance();}//进行日志增强，自动判断日志框架
    public static void main(String[] args) {
        SpringApplication.run(MySystemApplication.class, args);
        //ClientWorker clientWorker = new ClientWorker();
    }


    @Bean
    MeterRegistryCustomizer<MeterRegistry> meterRegistryCustomizer(
            @Value("${spring.application.name}") String applicationName
    ) {
        return (registry)->registry.config().commonTags("application" , applicationName);
    }
}
